﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FlexiCommerce.Components;

namespace FlexiCommerce.Web.Addons.FC.UI.Parts
{
    public partial class CategoryProducts : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void DomainDataSource1_QueryCreated(object sender, Microsoft.Web.Data.UI.WebControls.QueryCreatedEventArgs e)
        {
            var query = ((IQueryable<Product>)e.Query).Where(p => p.Categories.Contains(FlexiCommerce.Context.CurrentCategory));
            e.Query = ((IQueryable<Product>)e.Query).Where(p => p.Categories.Contains(FlexiCommerce.Context.CurrentCategory));
        }
    }
}